#include"process.h"
#define NUM 101
#define STJ '#'
void fflush_a(double total,double cnt)
{

  char buffer[NUM];
  char df[]="|/-\\";
  int len=strlen(df);
  memset(buffer,0,sizeof(buffer));
  int num=(int)(cnt*100/total);
  double rate=cnt/total*100;
  for(int i=0;i<num;i++)
  {
    buffer[i]=STJ;
  }
  static int b=0; 
  b%=len;
  printf("[%-100s][%.1f%%][%c]\r",buffer,rate,df[b]);
  b++;
  fflush(stdout);
}
void process1()
{
  char buffer[NUM];
  char df[]="|/-\\";
  int len=strlen(df);
  memset(buffer,0,sizeof(buffer));
  int cnt=0;
  while(cnt<=100)
  {
    printf("[%-100s][%d%%][%c]\r",buffer,cnt,df[cnt%len]);
    fflush(stdout);
    buffer[cnt]=STJ;
    cnt++;
    usleep(50000);
  }
  printf("\n");
}
